import { useCommon } from "@/stores/Common"
import { storeToRefs } from "pinia"
import { computed, reactive } from "vue";
const CommonStore = useCommon();

const { deviceOptions } = storeToRefs(CommonStore)


export const searchConfig = {
    groupName: {
        label: '项目名称',
        component: 'AInput',
        attrs: {
            allowClear: true,
            placeholder: '项目名称',
            style: {
                width: '100%'
            }
        }
    },
    specimenName: {
        label: '标本名称',
        component: 'AInput',
        attrs: {
            allowClear: true,
            placeholder: '标本名称',
            style: {
                width: '100%'
            }
        }
    }
}
export const addConfig = reactive({
    groupName: {
        label: '项目名称',
        component: 'AInput',
        attrs: {
            allowClear: true,
            placeholder: '项目名称',
            style: {
                width: '100%'
            }
        },
        rules: [{ required: true, message: "请输入项目名称", trigger: 'blur' }]
    },
    specimenName: {
        label: '标本名称',
        component: 'AInput',
        attrs: {
            allowClear: true,
            placeholder: '标本名称',
            style: {
                width: '100%'
            }
        },
        rules: [{ required: true, message: "请输入标本名称", trigger: 'blur' }]
    },
    serials: {
        component: 'ASelect',
        label: "可控设备",
        attrs: {
            allowClear: true,
            placeholder: "可控设备",
            mode: "multiple",
            maxTagCount: 5,
            options: deviceOptions,
            filterOption: (input: string, option: any) => {
                return option.label.includes(input)
            },
            style: {
                width: '100%'
            }
        },
        rules: [{ required: true, message: "请选择设备", trigger: 'change' }]
    },
})


export const columns = [
    {
        title: '序号',
        dataIndex: 'index',
        align: 'center',
        width: 80,
        fixed: 'left'
    },
    {
        title: '项目名称',
        dataIndex: 'groupName',
        align: 'center'
    },
    {
        title: '标本名称',
        dataIndex: 'specimenName',
        align: 'center'
    },
    {
        title: '可控设备',
        dataIndex: 'deviceNames',
        align: 'center'
    },
    {
        title: '操作',
        dataIndex: 'action',
        align: 'center'
    }
]